package com.fulin.leetcode;

import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

/**
 * TODO
 *
 * @Author fulin
 * @Date 2022/10/8 11:02
 **/
public class Num228_区间汇总 {
    public List<String> summaryRanges(int[] nums) {
        List<String> rs = new LinkedList<>();
        for(int L = 0,R = 0;R < nums.length;R++){
            if(R + 1 < nums.length && nums[R] + 1 == nums[R+1]){
                continue;
            }

            if(nums[L] == nums[R]){
                rs.add("" + nums[L]);
            }else {
                rs.add(nums[L] + "->" + nums[R]);
            }
            L = R + 1;
            new Random().nextGaussian();
        }
        return rs;
    }
}
